﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FilStartUps.DAL;

namespace FilStartUps
{
    public partial class Report : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                LinkButton lkHome = (LinkButton)FilStartUps_PageNav1.FindControl("lbLgout");
                LinkButton lkProfile = (LinkButton)FilStartUps_PageNav1.FindControl("lbProfile");
                lkProfile.Visible = true;
                lkHome.Visible = true;
            }
        }

        protected void reportbtn_Click(object sender, EventArgs e)
        {
            using (FilStartUpsEntities db_connect = new FilStartUpsEntities())
            {
                ForumReport report = new ForumReport();
                report.datereported = DateTime.Now;
                report.reportmessage = reportmessage.Text;
                report.forumreplyidFK= Convert.ToInt32(Request.QueryString["f"].Trim());
                report.forumthreadidFK = Convert.ToInt32(Request.QueryString["t"].Trim());
                db_connect.ForumReports.Add(report);
                db_connect.SaveChanges();

                Response.Redirect("~/ShowThread.aspx?t=" + Request.QueryString["t"].Trim());
            }
        }
    }
}